<?php
session_start();
$start_memory=memory_get_usage();
header('Content-Type: text/html; charset=utf-8');
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/functions.php');
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/database.php');
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/class.site.php');
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/class.forms.php');
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/class.modules.php');
ob_start("sanitize_output"); 
$site=new site();
$module=new module();
include($_SERVER['DOCUMENT_ROOT'].'/themes/'.$site->settings['folder_path'].'/header.php');
include($_SERVER['DOCUMENT_ROOT'].'/themes/'.$site->settings['folder_path'].'/navigation.php');
if(!empty($_GET['q'])) {
		
include($_SERVER['DOCUMENT_ROOT'].'/search.php');
} else {
include($_SERVER['DOCUMENT_ROOT'].'/themes/'.$site->settings['folder_path'].'/content.php');
}

include($_SERVER['DOCUMENT_ROOT'].'/themes/'.$site->settings['folder_path'].'/footer.php');
if($site->write_fs_cache) {
$content=ob_get_contents();
$site->setHtml($content); // saves an extra write!
}
$end_memory=memory_get_usage();
$total_memory_used=($end_memory - $start_memory);
$r=round(($total_memory_used / 1048576), 2);
//echo("Memory used: ".  $r  . "mb");
?>
